<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css" integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l" crossorigin="anonymous">
    <script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js">
    </script>
</head>
<body>
<form action="search" method="post">
    <div class="form-group">
        <label >出发地</label>
        <input type="text" name="from" class="form-control" value="{$Request.param.from}"  >
    </div>
    <div class="form-group">
        <label >目的地</label>
        <input type="text" name="to" class="form-control" id="exampleInputEmail2" value="{$Request.param.to}" >
    </div>
    <div class="form-group">
        <label>列车种类</label>
        <select name="train_type">
            <option value="">请选择</option>
              {volist name="types" id="v"}
            {if condition="$Request.param.train_type == $v.tid"}
            <option selected value="{$v.tid}">{$v.tname}</option>
            {else /}
            <option value="{$v.tid}">{$v.tname}</option>
            {/if}
              {/volist}
        </select>
    </div>
    <button type="submit" class="btn btn-primary">Submit</button>
</form>
<a href="/set">高级设置</a>
<table class="table">
    <thead>
    <tr>
        <th scope="col">车次</th>
        <th scope="col">出发地</th>
        <th scope="col">目的地</th>
        <th scope="col">到站时间</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
    {volist name="data" id="value"}
    <tr>
        <th scope="row">{$value.trian_sn}</th>
        <td>{$value.from}</td>
        <td>{$value.to}</td>
        <td>{$value.stationtime}</td>
        <td><button class="buy">抢票!</button></td>
    </tr>
    {/volist}
    </tbody>
</table>

</body>
</html>
<script>
$(".buy").on('click',function () {
    $.ajax({
        url:"http://www.yangxinpeng.com/buy",
        success:function (res){
            console.log(res);
            alert('res.msg');
        }
    })
})
</script>